import java.util.List;

public class Leetcode2038 {
    public static void main(String[] args) {
        System.out.println(winnerOfGame("ABBBBBBBAAA"));
    }

    public static boolean winnerOfGame(String colors) {
        int n = colors.length();
        int aContinuityNumber = 0;
        int bContinuityNumber = 0;
        char[] k = colors.toCharArray();
        for (int i = 2; i < n; i++) {
            if (k[i - 1] != k[i - 2] || k[i - 2] != k[i]) {
                continue;
            }

            if (k[i] == 'A') {
                aContinuityNumber++;
            } else if (k[i] == 'B') {
                bContinuityNumber++;
            }
        }

        return aContinuityNumber > bContinuityNumber;
    }
}
